package com.tistory.iam1492.network;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class SRNetworkInfo {

	public static boolean IsWifiAvailable(Context context)
	{
		ConnectivityManager m_NetConnectMgr= (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		boolean bConnect = false;
		try
		{
			if( m_NetConnectMgr == null ) return false;

			NetworkInfo info = m_NetConnectMgr.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
			bConnect = (info.isAvailable() && info.isConnected());

		}
		catch(Exception e)
		{
			return false;
		}
 
		return bConnect;
	}

	public static boolean Is3GAvailable(Context context)
	{  
		ConnectivityManager m_NetConnectMgr= (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		boolean bConnect = false;
		try
		{
			if( m_NetConnectMgr == null ) return false;
			NetworkInfo info = m_NetConnectMgr.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
			bConnect = (info.isAvailable() && info.isConnected());
		}
		catch(Exception e)
		{
			return false;
		}
 
		return bConnect;
	}
	
	public static boolean IsWibroAvailable(Context context)
	{  
		ConnectivityManager m_NetConnectMgr= (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		boolean bConnect = false;
		try
		{
			if( m_NetConnectMgr == null ) return false;
			NetworkInfo info = m_NetConnectMgr.getNetworkInfo(ConnectivityManager.TYPE_WIMAX);
			bConnect = (info.isAvailable() && info.isConnected());
		}
		catch(Exception e)
		{
			return false;
		}

		return bConnect;
	}
}
